package com.example.demo.aspect;

import com.example.demo.annotion.Test;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class TestAspect {

    @Pointcut("@annotation(com.example.demo.annotion.Test)")
    public void test() {
        log.info("aspect start...");
    }

    @After("test()")
    public void around(JoinPoint jp){
        log.info("arount");
        log.info("str:{}",jp.getSignature().toString());
        log.info("long str:{}",jp.getSignature().toLongString());
        log.info("short str:{}",jp.getSignature().toShortString());
        log.info("dec:{}",jp.getSignature().getDeclaringTypeName());
        log.info("name:{}",jp.getSignature().getName());
        log.info("str type:{}",jp.getSignature().getDeclaringType().toString());
        log.info(jp.getKind());
    }
}
